package fu.dan.qi.gen.processor;

import com.sun.source.tree.*;
import com.sun.source.util.*;
import com.sun.tools.javac.tree.*;
import fu.dan.qi.gen.annotation.*;
import fu.dan.qi.gen.tool.*;

import javax.annotation.processing.*;
import javax.lang.model.*;
import javax.lang.model.element.*;
import javax.tools.*;
import java.util.*;

@SupportedAnnotationTypes("fu.dan.qi.gen.annotation.ResourceBundleConstant")
@SupportedSourceVersion(SourceVersion.RELEASE_17)
public class ResourceBundleProcessor extends AbstractProcessor {


    @Override
    public synchronized void init(ProcessingEnvironment processingEnv) {
        super.init(processingEnv);
        processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "ResourceBundleProcessor start init...");
        OpenInnerModule.addOpensForResConstGen();
    }


    @Override
    public boolean process(Set<? extends TypeElement> annotations,
                           RoundEnvironment roundEnv) {

//        Trees trees = Trees.instance(processingEnv);
//        Set<? extends Element> elementsAnnotatedWith = roundEnv.getElementsAnnotatedWith(ResourceBundleConstant.class);
//        for (Element element : elementsAnnotatedWith) {
//            Tree tree = trees.getTree(element);
//        }
        return false;
    }
}